﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ERP_SupplyManage.aspx.cs" Inherits="CRM_Manager_ERP_SupplyManage" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>供货商管理</title>
    <link href="../css/PageStyle.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../JavaScript/Common.js"></script>
    <script type="text/javascript">
        function DoDelete() {
            if (!gridPanel_listdata.hasSelection()) {
                Ext.Msg.alert("提示", "请选择记录!");
                return;
            }
            Ext.Msg.confirm("确认框", "是否确认删除？", function (btn) {
                if (btn == "yes") {
                    var record = gridPanel_listdata.selModel.getSelected();
                    Ext.net.DirectMethods.DeleteModel(record.data.SupplyID);
                }
            });
        }

        function CheckItem() {
            if (!gridPanel_listdata.hasSelection()) {
                Ext.Msg.alert("提示", "请选择记录!");
                return;
            }
            var record = gridPanel_listdata.selModel.getSelected();
            Ext.net.DirectMethods.CheckSupply(record.data.SupplyID);
               
        }

        function StateRenderer(value) {
            if (value == 0) {
                return "<font color='#E0861A' >未提交</font>";
            } else if (value == 1) {
                return "<font color='#6FA8DC' >已提交</font>";
            } else if (value == 2) {
                return "<font color='green' >已审核</font>";
            }
            return value;
        }


    </script>
</head>
<body>
    <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" AjaxViewStateMode="Enabled" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
            <Content>
                <ext:Panel runat="server" Border="false" Layout="RowLayout">
                    <TopBar>
                        <ext:Toolbar runat="server">
                            <Items>
                                <ext:Button ID="extBtn_Refresh" runat="server" Text="刷新" Icon="ArrowRefresh">
                                    <Listeners>
                                        <Click Handler="gridPanel_listdata.reload();" />
                                    </Listeners>
                                </ext:Button>
                                <ext:Button ID="extBtn_Add" runat="server" Text="新增" Icon="Add" />
                                <ext:Button ID="extBtn_Edit" runat="server" Text="修改" Icon="GroupEdit" />
                                <ext:Button ID="extBtn_Delete" runat="server" Text="删除" Icon="Delete">
                                    <Listeners>
                                        <Click Fn="DoDelete" />
                                    </Listeners>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <Items>
                        <ext:FormPanel ID="searchForm" runat="server" Border="false" Padding="5" Height="67">
                            <Content>
                                <ext:FieldSet runat="server" Title="查询条件" Border="true" Layout="ColumnLayout" Header="true" Height="54">
                                    <Items>
                                        <ext:Container runat="server" Layout="FormLayout" LabelAlign="Right" ColumnWidth="0.33">
                                            <Items>
                                                <ext:TextField runat="server" ID="exttxtf_SupplyName" FieldLabel="供应商名称" AnchorHorizontal="0.95" />
                                            </Items>
                                        </ext:Container>
                                        <ext:Container runat="server" Layout="FormLayout" LabelAlign="Right" ColumnWidth="0.33">
                                            <Items>
                                                <ext:TextField runat="server" ID="exttxtf_Linkman" FieldLabel="联系人" AnchorHorizontal="0.95" />
                                            </Items>
                                        </ext:Container>
                                        <ext:Container ID="Container2" runat="server" Layout="FormLayout" LabelAlign="Right" ColumnWidth="0.33">
                                            <Items>
                                                <ext:Container ID="Container1" runat="server" Layout="ColumnLayout">
                                                    <Items>
                                                        <ext:Panel ID="Panel2" runat="server" Height="25" AnchorHorizontal="0.95" Border="false" ButtonAlign="Right">
                                                            <Content>
                                                                <table width="100%">
                                                                    <tr style="width: 100%">
                                                                        <td align="right">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                        </td>
                                                                        <td align="right" width="50%">
                                                                            <ext:Button ID="extBtn_Search" runat="server" Text="查询" Icon="Find">
                                                                                <Listeners>
                                                                                    <Click Handler="gridPanel_listdata.reload();" />
                                                                                </Listeners>
                                                                            </ext:Button>
                                                                        </td>
                                                                        <td align="right">&nbsp;&nbsp;&nbsp;&nbsp;
                                                                        </td>
                                                                        <td align="left" width="50%">
                                                                            <ext:Button ID="extBtn_Clear" runat="server" Text="清空" Icon="BasketDelete">
                                                                                <Listeners>
                                                                                    <Click Handler="searchForm.reset();" />
                                                                                </Listeners>
                                                                            </ext:Button>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </Content>
                                                        </ext:Panel>
                                                    </Items>
                                                </ext:Container>
                                            </Items>
                                        </ext:Container>
                                    </Items>
                                </ext:FieldSet>
                            </Content>
                        </ext:FormPanel>
                        <ext:Panel runat="server" Border="false" RowHeight="1" Layout="FitLayout">
                            <Content>
                                <ext:GridPanel runat="server" ID="gridPanel_listdata" BodyStyle="border-width:1 0 0 0;" AutoScroll="true" TrackMouseOver="true" StripeRows="true">
                                    <ColumnModel>
                                        <Columns>
                                            <ext:RowNumbererColumn Header="<center>序号</center>" Width="35" />
                                            <ext:Column Header="<center>供应商名称</center>" Width="180" DataIndex="SupplyName" />
                                            <ext:Column Header="<center>拼音码</center>" Width="80" DataIndex="Spell" />
                                            <ext:Column Header="<center>联系人</center>" Width="80" DataIndex="Linkman" />
                                            <ext:Column Header="<center>联系电话</center>" Width="100" DataIndex="Telephone" />
                                            <ext:Column Header="<center>邮箱</center>" Width="100" DataIndex="Email" />
                                            <ext:Column Header="<center>地址</center>" Width="150" DataIndex="Address" />
                                            <ext:Column Header="<center>录入人</center>" Width="150" DataIndex="InUserName" />
                                            <ext:Column Header="<center>审核状态</center>" Width="80" DataIndex="CheckState">
                                                <Renderer Fn="StateRenderer" />
                                            </ext:Column>
                                            <ext:Column Header="<center>备注</center>" Width="150" DataIndex="Address" />
                                        </Columns>
                                    </ColumnModel>
                                    <Store>
                                        <ext:Store runat="server" ID="Store1" OnRefreshData="MyData_Refresh">
                                            <Reader>
                                                <ext:JsonReader IDProperty="SupplyID">
                                                    <Fields>
                                                        <ext:RecordField Name="SupplyID" />
                                                        <ext:RecordField Name="SupplyName" />
                                                        <ext:RecordField Name="Spell" />
                                                        <ext:RecordField Name="Address" />
                                                        <ext:RecordField Name="Email" />
                                                        <ext:RecordField Name="Linkman" />
                                                        <ext:RecordField Name="Telephone" />
                                                        <ext:RecordField Name="Remark" />
                                                        <ext:RecordField Name="InUser" />
                                                        <ext:RecordField Name="InUserName" />
                                                        <ext:RecordField Name="CheckState" Type="Int" />
                                                    </Fields>
                                                </ext:JsonReader>
                                            </Reader>
                                        </ext:Store>
                                    </Store>
                                    <SelectionModel>
                                        <ext:RowSelectionModel runat="server" SingleSelect="true" />
                                    </SelectionModel>
                                    <BottomBar>
                                        <ext:PagingToolbar runat="server" ID="PagingToolbar1" PageSize="20" DisplayInfo="true"
                                            Height="25" DisplayMsg="显示{0} - {1},共{2}条" EmptyMsg="没有可显示的记录" StateID="Store1" />
                                    </BottomBar>
                                </ext:GridPanel>
                            </Content>
                        </ext:Panel>
                    </Items>
                </ext:Panel>
            </Content>
        </ext:Viewport>
    </form>
</body>
</html>
